﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="wfGenerarReportePedidos.aspx.cs" Inherits="WebGustozzi.ModuloVentas.GenerarReportePedidos" EnableSessionState="true" EnableViewState="true" Async="false"%>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CPHPrincipal" runat="server">
    <script type="text/javascript" src="../SCRIPT/ManejarControles.js"></script> 
    <script type="text/javascript" src="../SCRIPT/DialogosMaster.js"></script> 
    <script type="text/javascript" language="javascript">
        function ValidarFechas() {
            var oFecIni = window.document.getElementById('CPHPrincipal_txtFechaDesde').value;
            var oFecFin = window.document.getElementById('CPHPrincipal_txtFechaHasta').value;

            if (!CompararFechas(oFecFin, oFecIni)) {
                showPopupInformar(2, 'Reporte de Pedidos', 'La fecha de Fin debe ser posterior o igual a la fecha de Incio', '');
                return false;
            }
            return true;
        }
    </script>


    <asp:UpdatePanel ID="UpdatePanel1" runat="server"><contenttemplate>    
        <div id="contenedor5">

        <%--Titulo General--%>
        <table style="width:100%" cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td >
                    <asp:Label id="lblTarea" runat="server" Text=":: REPORTE DE PEDIDOS" 
                        SkinID="labelTitulo"></asp:Label>
                </td>
            </tr>    
            <tr>
                <td style="HEIGHT: 10px"></td>
            </tr>
        </table>  

        <%--Datos del Busqueda--%>
        <table style="width:100%" cellpadding="0" cellspacing="0" border="0" class="tdmarcoTitulo">
            <tr>
                <td colspan="8">
                <table style="width:100%" cellpadding="0" cellspacing="0" border="0">
                    <tr>
                        <td class="tdfondoTitulo" style="width:100%; HEIGHT: 18px" align="left" colspan="9">
                            <asp:Label ID="Label1" runat="server" SkinID="labelsubTituloSkin"  
                                Text=" :: Datos Reporte" Width="230px"></asp:Label>
                        </td>
                    </tr>
                </table>
                </td>
            </tr>
            <tr><td style="height:10px" colspan="8"></td></tr>
            <tr>
                <td  style="width:10px; height: 26px;">
                </td>
                <td style="width:80px">
                    <asp:Label ID="Label5" runat="server" Text="Fecha Pedido" SkinID="labelTextSkin" 
                         ></asp:Label>
                </td>
                <td style="width:130px">
                    <asp:Label ID="Label14" runat="server" Height="16px" SkinID="labelTextSkin" 
                        Text="Inicio" Width="35px"></asp:Label>
                    <asp:TextBox ID="txtFechaDesde" runat="server" SkinID="CajaTextoSkin" 
                        Width="70px"></asp:TextBox>
                    <asp:ImageButton ID="imgFecIni" runat="server" 
                        ImageUrl="~/imagenes/calendario_semana.png" />
                    <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtFechaDesde" PopupButtonID="imgFecIni">
                    </asp:CalendarExtender>
                    <asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtFechaDesde" Mask="99/99/9999" MaskType="Date">
                    </asp:MaskedEditExtender>
                </td>
                <td >
                    &nbsp;</td>
                <td  style="width:20px">
                    <asp:Label ID="Label3" runat="server" Text="Fin" SkinID="labelTextSkin" 
                        Width="20px" Height="16px"></asp:Label>
                </td>
                <td style="width:150px">
                    <asp:TextBox ID="txtFechaHasta" runat="server"  SkinID="CajaTextoSkin" Width="70px"></asp:TextBox>
                    <asp:ImageButton ID="imgFecFin" runat="server" ImageUrl="~/imagenes/calendario_semana.png" />
                    <asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtFechaHasta" PopupButtonID="imgFecFin">
                    </asp:CalendarExtender>
                    <asp:MaskedEditExtender ID="MaskedEditExtender2" runat="server" TargetControlID="txtFechaHasta" Mask="99/99/9999" MaskType="Date">
                    </asp:MaskedEditExtender>
                </td>
                <td style="width: 61px" >
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
           <tr>
                <td  style="width:10px; height: 26px;">
                </td>
                <td >
                    <asp:Label ID="Label2" runat="server" Text="Vendedor" SkinID="labelTextSkin" 
                        Width="70px"></asp:Label>
                </td>
                <td >
                    <asp:DropDownList ID="ddlVendedor" runat="server" 
                        SkinID="DropDownListTextSkin" Width="100px" AppendDataBoundItems="True">
                        <asp:ListItem Value="0">--Todos-- </asp:ListItem>
                    </asp:DropDownList>
                    </td>
                <td style="width:20px">
                    &nbsp;</td >
                <td   >
                    &nbsp;</td>
                <td  >
                    &nbsp;</td>
                <td style="width: 61px" >
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
           <tr>
                <td  style="width:10px; height: 26px;">
                </td>
                <td style=" height: 10px;">
                    <asp:Label ID="Label7" runat="server" Text="Cliente" 
                        SkinID="labelTextSkin" Width="70px" 
                        ></asp:Label>
                </td>
                <td style="width:20px">
                    <asp:DropDownList ID="ddlCliente" runat="server" 
                        SkinID="DropDownListTextSkin" Width="130px" AppendDataBoundItems="True">
                        <asp:ListItem Value="0">--Todos-- </asp:ListItem>
                    </asp:DropDownList>
                </td >
                <td >
                </td>
                <td >
                </td>
                <td>
                </td >
                <td style="width: 61px" >
                    &nbsp;</td>
                <td>
                </td>
            </tr>
            <tr>
                <td  style="width:10px; height: 26px;">
                </td>
                <td >
                    <asp:Label ID="Label10" runat="server" Text="Local Comercial" 
                        SkinID="labelTextSkin"></asp:Label>
                </td>
                <td style="width:23px; height: 10px;" >
                    <asp:DropDownList ID="ddlLocal" runat="server" 
                        SkinID="DropDownListTextSkin" Width="120px" AppendDataBoundItems="True">
                        <asp:ListItem Value="0">--Todos-- </asp:ListItem>
                    </asp:DropDownList>
                    </td>
                <td>
                    &nbsp;</td >
                <td >
                    &nbsp;</td >
                <td style="height: 10px" >
                    &nbsp;</td>
                <td style="width: 61px" >
                    &nbsp;</td>
                <td>
                </td>
            </tr>
 
            <tr>
                <td  style="width:10px; height: 26px;">
                </td>
                <td >
                    <asp:Label ID="Label4" runat="server" Text="Estado" SkinID="labelTextSkin" 
                         Height="16px"></asp:Label>
                </td>
                <td style="width:23px">
                    <asp:DropDownList ID="ddlEstado" runat="server" 
                        SkinID="DropDownListTextSkin" Width="100px" AppendDataBoundItems="True">
                        <asp:ListItem Value="0">--Todos-- </asp:ListItem>
                        <asp:ListItem>Pendiente</asp:ListItem>
                        <asp:ListItem>Facturado</asp:ListItem>
                        <asp:ListItem>Anulado</asp:ListItem>
                        <asp:ListItem>Observado</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td >
                    &nbsp;</td>
                <td >
                    &nbsp;</td>
                <td style="width:150px">
                    &nbsp;</td>
                <td style="width:61px">
                    <asp:Button ID="btnGenerar" runat="server" SkinID="ButtonTextSkin" Text="Generar" 
                        Width="70px" OnClick="btnGenerar_Click" />
                </td>
                <td style="width:100px">
                    <asp:Button ID="btnCerrar" runat="server" SkinID="ButtonTextSkin" Text="Cerrar" 
                        Width="70px" onclick="btnCerrar_Click" />
                </td>
            </tr>
             <tr><td style="height:10px" colspan="8"></td></tr>
        </table>
        <table>
            <tr style="height:10px"><td></td></tr>
        </table>


        <%--Grilla: Productos--%>
        <table style="WIDTH: 100%" cellspacing="0" cellpadding="0">
            <tr>
                <td>
                    <rsweb:ReportViewer ID="rvwPedidos" runat="server" Font-Names="Verdana" 
                        Font-Size="8pt" InteractiveDeviceInfos="(Collection)" 
                        WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="877px"
                        AsyncRendering="False">
                        <LocalReport ReportPath="ModuloVentas\ReporteVentas\repVe_PedidoVenta.rdlc">
                         
                            <DataSources>
                                <rsweb:ReportDataSource DataSourceId="SqlDSVentas" Name="DSVentas" />
                            </DataSources>
                         
                        </LocalReport>
                    </rsweb:ReportViewer>
                    <asp:SqlDataSource ID="SqlDSVentas" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ReporteConn %>" 
                        SelectCommand="pa_Sel_BuscarPedidos2" SelectCommandType="StoredProcedure">
                        <SelectParameters>
                            <asp:ControlParameter ControlID="txtFechaDesde" Name="fechaInicio" 
                                PropertyName="Text" Type="String" />
                            <asp:ControlParameter ControlID="txtFechaHasta" Name="fechaFin" 
                                PropertyName="Text" Type="String" />
                            <asp:ControlParameter ControlID="ddlVendedor" Name="idVendedor" 
                                PropertyName="SelectedValue" Type="Int32" />
                            <asp:ControlParameter ControlID="ddlCliente" Name="idCliente" 
                                PropertyName="SelectedValue" Type="Int32" />
                            <asp:ControlParameter ControlID="ddlLocal" Name="codigoLocal" 
                                PropertyName="SelectedValue" Type="Int32" />
                            <asp:ControlParameter ControlID="ddlEstado" Name="estado" 
                                PropertyName="SelectedValue" Type="String" />
                        </SelectParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
       </table>

        </div>

    </contenttemplate>  </asp:UpdatePanel>


</asp:Content>
